﻿using System;
using System.Collections;
using System.IO;
using System.Xml;

namespace YArchitech.HCLoad.XmlData
{
	public class DataBase
	{
		public DataBase()
		{
			this.hCurrIDList = new Hashtable();
			this.AddDataDict();
			this.AddMaterialTable();
			this.AddWallDataTemplDict();
			this.AddRoomParamTemplTable();
			this.AddKeyRoomTable();
			this.AddSysZoneTable();
			this.AddProject();
			this.wallDataTemplDict.LoadDefaultWallTempls();
		}

		public int CurrID
		{
			get
			{
				return this.nCurrID;
			}
			set
			{
				this.nCurrID = value;
			}
		}

		public int AddCurrID()
		{
			this.nCurrID++;
			return this.nCurrID;
		}

		public int DataVer
		{
			get
			{
				return this.nDataVer;
			}
			set
			{
				this.nDataVer = value;
			}
		}

		public int ver
		{
			get
			{
				return this.nver;
			}
			set
			{
				this.nver = value;
			}
		}

		public DataDict DataDict
		{
			get
			{
				return this.dataDict;
			}
		}

		private void AddDataDict()
		{
			try
			{
				this.dataDict = new DataDict(this);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
		}

		public MaterialTable MaterialTable
		{
			get
			{
				return this.materialTable;
			}
		}

		private void AddMaterialTable()
		{
			try
			{
				this.materialTable = new MaterialTable(this);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
		}

		public WallDataTemplDict WallDataTemplDict
		{
			get
			{
				return this.wallDataTemplDict;
			}
		}

		private void AddWallDataTemplDict()
		{
			try
			{
				this.wallDataTemplDict = new WallDataTemplDict(this);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
		}

		public RoomParamTemplTable RoomParamTemplTable
		{
			get
			{
				return this.roomParamTemplTable;
			}
		}

		private void AddRoomParamTemplTable()
		{
			try
			{
				this.roomParamTemplTable = new RoomParamTemplTable(this);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
		}

		public KeyRoomTable KeyRoomTable
		{
			get
			{
				return this.keyRoomTable;
			}
		}

		private void AddKeyRoomTable()
		{
			try
			{
				this.keyRoomTable = new KeyRoomTable(this);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
		}

		public SysZoneTable SysZoneTable
		{
			get
			{
				return this.sysZoneTable;
			}
		}

		private void AddSysZoneTable()
		{
			try
			{
				this.sysZoneTable = new SysZoneTable(this);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
		}

		public Project Project
		{
			get
			{
				return this.project;
			}
		}

		private void AddProject()
		{
			try
			{
				this.project = new Project(this);
				this.project.ID = this.AddCurrID();
				this.hCurrIDList.Add(this.project.ID, this.project);
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
		}

		public bool LoadXMLFile(string XMLFilePath)
		{
			bool result;
			try
			{
				if (!File.Exists(XMLFilePath))
				{
					result = false;
				}
				else
				{
					this.nCurrID = 0;
					this.hCurrIDList = new Hashtable();
					XmlDocument xmlDocument = new XmlDocument();
					xmlDocument.Load(XMLFilePath);
					XmlNode xmlNode = null;
					XmlElement xmlElement = null;
					xmlNode = xmlDocument.SelectSingleNode("DataBase");
					xmlElement = (XmlElement)xmlNode;
					this.DataVer = int.Parse(xmlElement.GetAttribute("DataVer"));
					this.ver = int.Parse(xmlElement.GetAttribute("ver"));
					XmlNode xmlNode2 = xmlNode.SelectSingleNode("DataDict").SelectSingleNode("RoomParam");
					if (xmlNode2 != null)
					{
						foreach (object obj in xmlNode2.ChildNodes)
						{
							xmlElement = (XmlElement)((XmlNode)obj);
							RoomParam roomParam = new RoomParam(this.dataDict.RoomParams);
							roomParam.ID = int.Parse(xmlElement.GetAttribute("ID"));
							roomParam.SufferId = int.Parse(xmlElement.GetAttribute("SufferId"));
							roomParam.RoomParamId = int.Parse(xmlElement.GetAttribute("RoomParamId"));
							roomParam.EquipmentUnit = int.Parse(xmlElement.GetAttribute("EquipmentUnit"));
							roomParam.LightUnit = int.Parse(xmlElement.GetAttribute("LightUnit"));
							roomParam.PeopleUnit = int.Parse(xmlElement.GetAttribute("PeopleUnit"));
							roomParam.FreshAirUnit = int.Parse(xmlElement.GetAttribute("FreshAirUnit"));
							roomParam.RfhType = int.Parse(xmlElement.GetAttribute("RfhType"));
							roomParam.Name = xmlElement.GetAttribute("Name");
							roomParam.LaoDongQd = xmlElement.GetAttribute("LaoDongQd");
							if (xmlElement.GetAttribute("IsInsideRoom") == "0")
							{
								roomParam.IsInsideRoom = false;
							}
							else
							{
								roomParam.IsInsideRoom = true;
							}
							roomParam.EquipmentPreArea = double.Parse(xmlElement.GetAttribute("EquipmentPreArea"));
							roomParam.LightingPerArea = double.Parse(xmlElement.GetAttribute("LightingPerArea"));
							roomParam.PeoplePerArea = double.Parse(xmlElement.GetAttribute("PeoplePerArea"));
							roomParam.FreshAirPerArea = double.Parse(xmlElement.GetAttribute("FreshAirPerArea"));
							roomParam.DjSnSjWd = double.Parse(xmlElement.GetAttribute("DjSnSjWd"));
							roomParam.DjSNSjXdSd = double.Parse(xmlElement.GetAttribute("DjSNSjXdSd"));
							roomParam.XjSnSjWd = double.Parse(xmlElement.GetAttribute("XjSnSjWd"));
							roomParam.XjSnSjXdSd = double.Parse(xmlElement.GetAttribute("XjSnSjXdSd"));
							roomParam.RenYuanMd = double.Parse(xmlElement.GetAttribute("RenYuanMd"));
							roomParam.ZhaoMingBz = double.Parse(xmlElement.GetAttribute("ZhaoMingBz"));
							roomParam.SheBeiBz = double.Parse(xmlElement.GetAttribute("SheBeiBz"));
							roomParam.XingFengL = double.Parse(xmlElement.GetAttribute("XingFengL"));
							roomParam.ZaoYin = double.Parse(xmlElement.GetAttribute("ZaoYin"));
							roomParam.ZongLengZb = double.Parse(xmlElement.GetAttribute("ZongLengZb"));
							roomParam.ZongReZb = double.Parse(xmlElement.GetAttribute("ZongReZb"));
							roomParam.WeiHuLengZb = double.Parse(xmlElement.GetAttribute("WeiHuLengZb"));
							roomParam.RenYuanLengZb = double.Parse(xmlElement.GetAttribute("RenYuanLengZb"));
							roomParam.XingFengLengZb = double.Parse(xmlElement.GetAttribute("XingFengLengZb"));
							roomParam.OtherLengZb = double.Parse(xmlElement.GetAttribute("OtherLengZb"));
							roomParam.WeiHuReZb = double.Parse(xmlElement.GetAttribute("WeiHuReZb"));
							roomParam.RenYuanReZb = double.Parse(xmlElement.GetAttribute("RenYuanReZb"));
							roomParam.XingFengReZb = double.Parse(xmlElement.GetAttribute("XingFengReZb"));
							this.DataDict.RoomParams.LoadRoomParam(roomParam);
						}
					}
					xmlNode2 = xmlNode.SelectSingleNode("DataDict").SelectSingleNode("TimeAssign");
					if (xmlNode2 != null)
					{
						foreach (object obj2 in xmlNode2.ChildNodes)
						{
							xmlElement = (XmlElement)((XmlNode)obj2);
							TimeAssign timeAssign = new TimeAssign(this.DataDict.TimeAssigns);
							timeAssign.ID = int.Parse(xmlElement.GetAttribute("ID"));
							timeAssign.Name = xmlElement.GetAttribute("Name");
							timeAssign.T0 = double.Parse(xmlElement.GetAttribute("T0"));
							timeAssign.T1 = double.Parse(xmlElement.GetAttribute("T1"));
							timeAssign.T2 = double.Parse(xmlElement.GetAttribute("T2"));
							timeAssign.T3 = double.Parse(xmlElement.GetAttribute("T3"));
							timeAssign.T4 = double.Parse(xmlElement.GetAttribute("T4"));
							timeAssign.T5 = double.Parse(xmlElement.GetAttribute("T5"));
							timeAssign.T6 = double.Parse(xmlElement.GetAttribute("T6"));
							timeAssign.T7 = double.Parse(xmlElement.GetAttribute("T7"));
							timeAssign.T8 = double.Parse(xmlElement.GetAttribute("T8"));
							timeAssign.T9 = double.Parse(xmlElement.GetAttribute("T9"));
							timeAssign.T10 = double.Parse(xmlElement.GetAttribute("T10"));
							timeAssign.T11 = double.Parse(xmlElement.GetAttribute("T11"));
							timeAssign.T12 = double.Parse(xmlElement.GetAttribute("T12"));
							timeAssign.T13 = double.Parse(xmlElement.GetAttribute("T13"));
							timeAssign.T14 = double.Parse(xmlElement.GetAttribute("T14"));
							timeAssign.T15 = double.Parse(xmlElement.GetAttribute("T15"));
							timeAssign.T16 = double.Parse(xmlElement.GetAttribute("T16"));
							timeAssign.T17 = double.Parse(xmlElement.GetAttribute("T17"));
							timeAssign.T18 = double.Parse(xmlElement.GetAttribute("T18"));
							timeAssign.T19 = double.Parse(xmlElement.GetAttribute("T19"));
							timeAssign.T20 = double.Parse(xmlElement.GetAttribute("T20"));
							timeAssign.T21 = double.Parse(xmlElement.GetAttribute("T21"));
							timeAssign.T22 = double.Parse(xmlElement.GetAttribute("T22"));
							timeAssign.T23 = double.Parse(xmlElement.GetAttribute("T23"));
							this.DataDict.TimeAssigns.LoadTimeAssign(timeAssign);
						}
					}
					xmlNode2 = xmlNode.SelectSingleNode("MaterialTable");
					if (xmlNode2 != null)
					{
						foreach (object obj3 in xmlNode2.ChildNodes)
						{
							xmlElement = (XmlElement)((XmlNode)obj3);
							Material material = new Material(this.MaterialTable);
							material.ID = int.Parse(xmlElement.GetAttribute("ID"));
							material.MaterialID = int.Parse(xmlElement.GetAttribute("MaterialID"));
							material.Name = xmlElement.GetAttribute("Name");
							material.materialDescription = xmlElement.GetAttribute("materialDescription");
							material.SufferId = int.Parse(xmlElement.GetAttribute("SufferId"));
							material.Gmd = double.Parse(xmlElement.GetAttribute("Gmd"));
							material.DrXs = double.Parse(xmlElement.GetAttribute("DrXs"));
							material.Brr = double.Parse(xmlElement.GetAttribute("Brr"));
							this.MaterialTable.LoadMaterial(material);
						}
					}
					xmlNode2 = xmlNode.SelectSingleNode("WallDataTemplDict");
					if (xmlNode2 != null)
					{
						foreach (object obj4 in xmlNode2.SelectNodes("WhTempl"))
						{
							XmlNode xmlNode3 = (XmlNode)obj4;
							xmlElement = (XmlElement)xmlNode3;
							WhTempl whTempl = new WhTempl(this.WallDataTemplDict);
							whTempl.ID = int.Parse(xmlElement.GetAttribute("ID"));
							whTempl.WhId = int.Parse(xmlElement.GetAttribute("WhId"));
							whTempl.Name = xmlElement.GetAttribute("Name");
							whTempl.Description = xmlElement.GetAttribute("Description");
							whTempl.WhType = xmlElement.GetAttribute("WhType");
							whTempl.SufferId = int.Parse(xmlElement.GetAttribute("SufferId"));
							whTempl.AutoCalDjCrXs = int.Parse(xmlElement.GetAttribute("AutoCalDjCrXs"));
							foreach (object obj5 in xmlNode3.SelectNodes("Material"))
							{
								XmlElement xmlElement2 = (XmlElement)((XmlNode)obj5);
								whTempl.AddWhTemplMaterial(new WhTemplMaterial(whTempl)
								{
									Thick = double.Parse(xmlElement2.GetAttribute("Thick")),
									DrXsXz = double.Parse(xmlElement2.GetAttribute("DrXsXz")),
									MaterialID = int.Parse(xmlElement2.GetAttribute("MaterialID"))
								});
							}
							foreach (object obj6 in xmlNode3.SelectNodes("WallPart"))
							{
								XmlElement xmlElement2 = (XmlElement)((XmlNode)obj6);
								whTempl.AddWallPart(new WallPart(whTempl)
								{
									PartPer = int.Parse(xmlElement2.GetAttribute("PartPer")),
									PartID = int.Parse(xmlElement2.GetAttribute("PartID"))
								});
							}
							this.WallDataTemplDict.LoadWhTempl(whTempl);
						}
					}
					this.WallDataTemplDict.ClearDefaultWallTempl();
					xmlNode2 = xmlNode.SelectSingleNode("WallDataTemplDict");
					foreach (object obj7 in xmlNode2.SelectNodes("DefaultWallTempl"))
					{
						xmlElement = (XmlElement)((XmlNode)obj7);
						DefaultWallTempl defaultWallTempl = new DefaultWallTempl(this.WallDataTemplDict);
						defaultWallTempl.Name = xmlElement.GetAttribute("Name");
						defaultWallTempl.ID = int.Parse(xmlElement.GetAttribute("ID"));
						this.WallDataTemplDict.LoadDefaultWallTempl(defaultWallTempl);
					}
					xmlNode2 = xmlNode.SelectSingleNode("RoomParamTemplTable");
					if (xmlNode2 != null)
					{
						foreach (object obj8 in xmlNode2.ChildNodes)
						{
							xmlElement = (XmlElement)((XmlNode)obj8);
							RoomInterParam roomInterParam = new RoomInterParam(this.RoomParamTemplTable);
							roomInterParam.ID = int.Parse(xmlElement.GetAttribute("ID"));
							roomInterParam.Name = xmlElement.GetAttribute("Name");
							roomInterParam.RoomParamID = int.Parse(xmlElement.GetAttribute("RoomParamID"));
							this.RoomParamTemplTable.LoadRoomInterParam(roomInterParam);
						}
					}
					xmlNode2 = xmlNode.SelectSingleNode("KeyRoomTable");
					if (xmlNode2 != null)
					{
						foreach (object obj9 in xmlNode2.ChildNodes)
						{
							xmlElement = (XmlElement)((XmlNode)obj9);
							KeyRoom keyRoom = new KeyRoom(this.KeyRoomTable);
							keyRoom.ID = int.Parse(xmlElement.GetAttribute("ID"));
							keyRoom.Name = xmlElement.GetAttribute("Name");
							keyRoom.KeyRoomID = int.Parse(xmlElement.GetAttribute("KeyRoomID"));
							this.KeyRoomTable.LoadKeyRoom(keyRoom);
						}
					}
					xmlNode2 = xmlNode.SelectSingleNode("SysZoneTable");
					if (xmlNode2 != null)
					{
						foreach (object obj10 in xmlNode2.ChildNodes)
						{
							xmlElement = (XmlElement)((XmlNode)obj10);
							SysZone sysZone = new SysZone(this.SysZoneTable);
							sysZone.ID = int.Parse(xmlElement.GetAttribute("ID"));
							sysZone.Name = xmlElement.GetAttribute("Name");
							sysZone.Description = xmlElement.GetAttribute("Description");
							sysZone.GuidString = xmlElement.GetAttribute("GuidString");
							sysZone.StyleName = xmlElement.GetAttribute("StyleName");
							sysZone.ZsLfhXr = DataBase.StrToDblArr(xmlElement.GetAttribute("ZsLfhXr"));
							sysZone.ZsLfhQr = DataBase.StrToDblArr(xmlElement.GetAttribute("ZsLfhQr"));
							sysZone.ZsSfh = DataBase.StrToDblArr(xmlElement.GetAttribute("ZsSfh"));
							sysZone.DjRfhXr = double.Parse(xmlElement.GetAttribute("DjRfhXr"));
							sysZone.DjRfhQr = double.Parse(xmlElement.GetAttribute("DjRfhQr"));
							sysZone.DjSfh = double.Parse(xmlElement.GetAttribute("DjSfh"));
							this.SysZoneTable.LoadSysZone(sysZone);
						}
					}
					XmlNode xmlNode4 = xmlNode.SelectSingleNode("Project");
					if (xmlNode4 == null)
					{
						result = false;
					}
					else
					{
						xmlElement = (XmlElement)xmlNode4;
						this.project.ID = int.Parse(xmlElement.GetAttribute("ID"));
						if (this.nCurrID < this.project.ID)
						{
							this.nCurrID = this.project.ID + 1;
						}
						this.hCurrIDList.Add(this.project.ID, this.project);
						this.project.LfhUnit = int.Parse(xmlElement.GetAttribute("LfhUnit"));
						this.project.SfhUnit = int.Parse(xmlElement.GetAttribute("SfhUnit"));
						this.project.SfhXzXs = (double)int.Parse(xmlElement.GetAttribute("SfhXzXs"));
						this.project.RfhUnit = int.Parse(xmlElement.GetAttribute("RfhUnit"));
						this.project.CalType = int.Parse(xmlElement.GetAttribute("CalType"));
						this.project.Name = xmlElement.GetAttribute("Name");
						this.project.Description = xmlElement.GetAttribute("Description");
						this.project.GuidString = xmlElement.GetAttribute("GuidString");
						this.project.projectNum = xmlElement.GetAttribute("projectNum");
						this.project.BuilderUnit = xmlElement.GetAttribute("BuilderUnit");
						this.project.CalPeople = xmlElement.GetAttribute("CalPeople");
						this.project.CheckPeople = xmlElement.GetAttribute("CheckPeople");
						this.project.RedactPeople = xmlElement.GetAttribute("RedactPeople");
						this.project.ProjectTime = xmlElement.GetAttribute("ProjectTime");
						this.project.ZsLfhXr = DataBase.StrToDblArr(xmlElement.GetAttribute("ZsLfhXr"));
						this.project.ZsLfhQr = DataBase.StrToDblArr(xmlElement.GetAttribute("ZsLfhQr"));
						this.project.ZsSfh = DataBase.StrToDblArr(xmlElement.GetAttribute("ZsSfh"));
						this.project.DjRfhXr = double.Parse(xmlElement.GetAttribute("DjRfhXr"));
						this.project.DjRfhQr = double.Parse(xmlElement.GetAttribute("DjRfhQr"));
						this.project.DjSfh = double.Parse(xmlElement.GetAttribute("DjSfh"));
						this.project.LfhXzXs = double.Parse(xmlElement.GetAttribute("LfhXzXs"));
						this.project.RfhXzXs = double.Parse(xmlElement.GetAttribute("RfhXzXs"));
						xmlElement = (XmlElement)xmlNode4.SelectSingleNode("WeatherData");
						this.project.WeatherData.ID = int.Parse(xmlElement.GetAttribute("ID"));
						if (this.nCurrID < this.project.WeatherData.ID)
						{
							this.nCurrID = this.project.WeatherData.ID + 1;
						}
						this.project.WeatherData.DataVersion = int.Parse(xmlElement.GetAttribute("DataVersion"));
						this.project.WeatherData.CityId = int.Parse(xmlElement.GetAttribute("CityId"));
						this.project.WeatherData.XjKtDqTmdDj = int.Parse(xmlElement.GetAttribute("XjKtDqTmdDj"));
						this.project.WeatherData.District = int.Parse(xmlElement.GetAttribute("District"));
						this.project.WeatherData.City = xmlElement.GetAttribute("City");
						this.project.WeatherData.Province = xmlElement.GetAttribute("Province");
						this.project.WeatherData.Country = xmlElement.GetAttribute("Country");
						this.project.WeatherData.Jd = double.Parse(xmlElement.GetAttribute("Jd"));
						this.project.WeatherData.Wd = double.Parse(xmlElement.GetAttribute("Wd"));
						this.project.WeatherData.XjDqy = double.Parse(xmlElement.GetAttribute("XjDqy"));
						this.project.WeatherData.XjKtSwGqWd = double.Parse(xmlElement.GetAttribute("XjKtSwGqWd"));
						this.project.WeatherData.XjKtSwSqWd = double.Parse(xmlElement.GetAttribute("XjKtSwSqWd"));
						this.project.WeatherData.XjKtRpjQw = double.Parse(xmlElement.GetAttribute("XjKtRpjQw"));
						this.project.WeatherData.XjJsRjc = double.Parse(xmlElement.GetAttribute("XjJsRjc"));
						this.project.WeatherData.XjSwPjFs = double.Parse(xmlElement.GetAttribute("XjSwPjFs"));
						this.project.WeatherData.ZryPjXdSd = double.Parse(xmlElement.GetAttribute("ZryPjXdSd"));
						this.project.WeatherData.DjDqy = double.Parse(xmlElement.GetAttribute("DjDqy"));
						this.project.WeatherData.DjKtSwGqWd = double.Parse(xmlElement.GetAttribute("DjKtSwGqWd"));
						this.project.WeatherData.DjCnSwGqWd = double.Parse(xmlElement.GetAttribute("DjCnSwGqWd"));
						this.project.WeatherData.DjSwPjFs = double.Parse(xmlElement.GetAttribute("DjSwPjFs"));
						this.project.WeatherData.ZlyPjXdSd = double.Parse(xmlElement.GetAttribute("ZlyPjXdSd"));
						this.project.WeatherData.N = double.Parse(xmlElement.GetAttribute("N"));
						this.project.WeatherData.NE = double.Parse(xmlElement.GetAttribute("NE"));
						this.project.WeatherData.E = double.Parse(xmlElement.GetAttribute("E"));
						this.project.WeatherData.SE = double.Parse(xmlElement.GetAttribute("SE"));
						this.project.WeatherData.S = double.Parse(xmlElement.GetAttribute("S"));
						this.project.WeatherData.SW = double.Parse(xmlElement.GetAttribute("SW"));
						this.project.WeatherData.W = double.Parse(xmlElement.GetAttribute("W"));
						this.project.WeatherData.NW = double.Parse(xmlElement.GetAttribute("NW"));
						this.project.WeatherData.DbmPjWd = double.Parse(xmlElement.GetAttribute("DbmPjWd"));
						this.project.WeatherData.DbmZryPjWd = double.Parse(xmlElement.GetAttribute("DbmZryPjWd"));
						this.project.WeatherData.DbmZlyPjWd = double.Parse(xmlElement.GetAttribute("DbmZlyPjWd"));
						this.project.BuildingCollect.ClearBuilding();
						xmlNode2 = xmlNode4.SelectSingleNode("BuildingCollect");
						if (xmlNode2 != null)
						{
							foreach (object obj11 in xmlNode2.ChildNodes)
							{
								xmlElement = (XmlElement)((XmlNode)obj11);
								Building building = new Building(this.project.BuildingCollect);
								building.ID = int.Parse(xmlElement.GetAttribute("ID"));
								building.StartFloorNum = int.Parse(xmlElement.GetAttribute("StartFloorNum"));
								building.EndFloorNum = int.Parse(xmlElement.GetAttribute("EndFloorNum"));
								building.Name = xmlElement.GetAttribute("Name");
								building.Description = xmlElement.GetAttribute("Description");
								building.GuidString = xmlElement.GetAttribute("GuidString");
								building.ZsLfhXr = DataBase.StrToDblArr(xmlElement.GetAttribute("ZsLfhXr"));
								building.ZsLfhQr = DataBase.StrToDblArr(xmlElement.GetAttribute("ZsLfhQr"));
								building.ZsSfh = DataBase.StrToDblArr(xmlElement.GetAttribute("ZsSfh"));
								building.DjRfhXr = double.Parse(xmlElement.GetAttribute("DjRfhXr"));
								building.DjRfhQr = double.Parse(xmlElement.GetAttribute("DjRfhQr"));
								building.DjSfh = double.Parse(xmlElement.GetAttribute("DjSfh"));
								building.BuildingStartElevation = double.Parse(xmlElement.GetAttribute("BuildingStartElevation"));
								building.BuildingVolume = double.Parse(xmlElement.GetAttribute("BuildingVolume"));
								building.SjWd = double.Parse(xmlElement.GetAttribute("SjWd"));
								building.FyXsCf = double.Parse(xmlElement.GetAttribute("FyXsCf"));
								building.RyXsCr = double.Parse(xmlElement.GetAttribute("RyXsCr"));
								building.WhJgWbmXsXs = double.Parse(xmlElement.GetAttribute("WhJgWbmXsXs"));
								building.WqWbmXsXS = double.Parse(xmlElement.GetAttribute("WqWbmXsXS"));
								building.XjWhJgWbmHrXs = double.Parse(xmlElement.GetAttribute("XjWhJgWbmHrXs"));
								building.DjWhJgWbmHrXs = double.Parse(xmlElement.GetAttribute("DjWhJgWbmHrXs"));
								building.WhJgNbmHrXs = double.Parse(xmlElement.GetAttribute("WhJgNbmHrXs"));
								building.DjWhJgFlFjXs = double.Parse(xmlElement.GetAttribute("DjWhJgFlFjXs"));
								XmlNode xmlNode5 = xmlElement.SelectSingleNode("DefaultWallCollect");
								if (xmlNode5 != null)
								{
									foreach (object obj12 in xmlNode5.ChildNodes)
									{
										XmlElement xmlElement2 = (XmlElement)((XmlNode)obj12);
										DefaultWall defaultWall = new DefaultWall(building.DefaultWallCollect);
										defaultWall.WallId = int.Parse(xmlElement2.GetAttribute("WallId"));
										defaultWall.WallType = xmlElement2.GetAttribute("WallType");
										building.DefaultWallCollect.AddDefaultWall(defaultWall);
									}
								}
								xmlNode5 = xmlElement.SelectSingleNode("KeyFloorTable");
								if (xmlNode5 != null)
								{
									foreach (object obj13 in xmlNode5.ChildNodes)
									{
										XmlElement xmlElement2 = (XmlElement)((XmlNode)obj13);
										KeyFloorTable keyFloorTable = new KeyFloorTable(building.KeyFloorTables);
										keyFloorTable.ID = int.Parse(xmlElement2.GetAttribute("ID"));
										keyFloorTable.KeyFloorID = int.Parse(xmlElement2.GetAttribute("KeyFloorID"));
										keyFloorTable.Name = xmlElement2.GetAttribute("Name");
										building.KeyFloorTables.LoadKeyFloorTable(keyFloorTable);
									}
								}
								building.OrientationFixs.Clear();
								xmlNode5 = xmlElement.SelectSingleNode("OrientationFix");
								if (xmlNode5 != null)
								{
									foreach (object obj14 in xmlNode5.ChildNodes)
									{
										XmlElement xmlElement2 = (XmlElement)((XmlNode)obj14);
										OrientationFix orientationFix = new OrientationFix(building.OrientationFixs);
										orientationFix.Direction = xmlElement2.GetAttribute("Direction");
										orientationFix.FwjXz = double.Parse(xmlElement2.GetAttribute("FwjXz"));
										building.OrientationFixs.AddOrientationFix(orientationFix);
									}
								}
								building.FloorCollect.ClearFloor();
								xmlNode5 = xmlElement.SelectSingleNode("FloorCollect");
								if (xmlNode5 != null)
								{
									foreach (object obj15 in xmlNode5.ChildNodes)
									{
										XmlElement xmlElement2 = (XmlElement)((XmlNode)obj15);
										Floor floor = new Floor(building.FloorCollect);
										floor.FloorClass = int.Parse(xmlElement2.GetAttribute("FloorClass"));
										floor.ID = int.Parse(xmlElement2.GetAttribute("ID"));
										floor.FloorNum = int.Parse(xmlElement2.GetAttribute("FloorNum"));
										floor.Name = xmlElement2.GetAttribute("Name");
										floor.Description = xmlElement2.GetAttribute("Description");
										floor.GuidString = xmlElement2.GetAttribute("GuidString");
										floor.ZsLfhXr = DataBase.StrToDblArr(xmlElement2.GetAttribute("ZsLfhXr"));
										floor.ZsLfhQr = DataBase.StrToDblArr(xmlElement2.GetAttribute("ZsLfhQr"));
										floor.DjRfhXr = double.Parse(xmlElement2.GetAttribute("DjRfhXr"));
										floor.DjRfhQr = double.Parse(xmlElement2.GetAttribute("DjRfhQr"));
										floor.DjSfh = double.Parse(xmlElement2.GetAttribute("DjSfh"));
										floor.FloorHeight = double.Parse(xmlElement2.GetAttribute("FloorHeight"));
										floor.WindowHeight = double.Parse(xmlElement2.GetAttribute("WindowHeight"));
										XmlNode xmlNode6 = xmlElement2.SelectSingleNode("RoomCollect");
										if (xmlNode6 != null)
										{
											if (floor.RoomCollect == null)
											{
												floor.AddRoomCollect();
											}
											foreach (object obj16 in xmlNode6.ChildNodes)
											{
												XmlElement xe = (XmlElement)((XmlNode)obj16);
												Room room = new Room(floor.RoomCollect);
												if (room.DoPropExchange(xe, true))
												{
													floor.RoomCollect.LoadRoom(room);
												}
											}
										}
										building.FloorCollect.LoadFloor(floor);
									}
								}
								this.project.BuildingCollect.LoadBuilding(building);
							}
						}
						result = true;
					}
				}
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
			return result;
		}

		public static double[] StrArrToDblArr(string[] asTmp)
		{
			double[] result;
			try
			{
				bool flag = false;
				double[] array = new double[asTmp.Length];
				for (int i = 0; i < asTmp.Length; i++)
				{
					if (asTmp[i] != "")
					{
						array[i] = double.Parse(asTmp[i]);
						flag = true;
					}
				}
				if (!flag && array.Length == 1)
				{
					array = null;
				}
				result = array;
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
			return result;
		}

		public static double[] StrToDblArr(string sTmp, char cSplit)
		{
			double[] result;
			try
			{
				if (string.IsNullOrEmpty(sTmp))
				{
					result = new double[24];
				}
				else
				{
					result = DataBase.StrArrToDblArr(sTmp.Split(new char[]
					{
						cSplit
					}));
				}
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
			return result;
		}

		public static double[] StrToDblArr(string sTmp)
		{
			double[] result;
			try
			{
				result = DataBase.StrToDblArr(sTmp, ',');
			}
			catch (Exception ex)
			{
				throw new Exception(ex.ToString());
			}
			return result;
		}

		private int nCurrID;

		public Hashtable hCurrIDList;

		private int nDataVer = 3;

		private int nver = 5;

		private DataDict dataDict;

		private MaterialTable materialTable;

		private WallDataTemplDict wallDataTemplDict;

		private RoomParamTemplTable roomParamTemplTable;

		private KeyRoomTable keyRoomTable;

		private SysZoneTable sysZoneTable;

		private Project project;

		private const int nTimeCount = 24;
	}
}
